from typing import List
class Solution:
    def maxSubArray(self, nums: List[int]) -> int:
        new_arr =[nums[0]]
        for i in range(1,len(nums)):
            print(nums[i],new_arr[i-1]+nums[i])
            new_arr.append(max(nums[i],new_arr[i-1]+nums[i]))
        print(new_arr)
        return max(new_arr)

nums = [-2,1,-3,4,-1,2,1,-5,4]
s=Solution()
print(s.maxSubArray(nums))